package com.thon.entity.user;

// Generated 2013-9-23 19:12:56 by Hibernate Tools 3.4.0.CR1

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;

import static javax.persistence.GenerationType.IDENTITY;

import javax.persistence.CascadeType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.thon.entity.util.IdEntity;

/**
 * MeUserBind generated by hbm2java
 */
@Entity
@Table(name = "user_binds")
@JsonIgnoreProperties(ignoreUnknown = true)
public class UserBind extends IdEntity {

	private static final long serialVersionUID = 350268066419263440L;
	private User user;
	private String token;
	private byte platform;
	private Date createdDate;
	private byte bindType;

	public UserBind() {
	}

	public UserBind(User user, String token, byte platform,
			Date createdDate, byte bindType) {
		this.user = user;
		this.token = token;
		this.platform = platform;
		this.createdDate = createdDate;
		this.bindType = bindType;
	}

	@OneToOne(cascade = CascadeType.MERGE)
	@JoinColumn(name = "user_id")
	@JsonIgnoreProperties(value = { "hibernateLazyInitializer", "handler" })
	public User getUser() {
		return this.user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	public String getToken() {
		return this.token;
	}

	public void setToken(String token) {
		this.token = token;
	}

	public byte getPlatform() {
		return this.platform;
	}

	public void setPlatform(byte platform) {
		this.platform = platform;
	}

	@Temporal(TemporalType.TIMESTAMP)
	public Date getCreatedDate() {
		return this.createdDate;
	}

	public void setCreatedDate(Date createdDate) {
		this.createdDate = createdDate;
	}

	public byte getBindType() {
		return this.bindType;
	}

	public void setBindType(byte bindType) {
		this.bindType = bindType;
	}

}
